Thread: how to write a Tetris [newbie]

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    4

    how to write a Tetris [newbie]

    what do i have to know to write a Tetris prog. [simple C, without any bonus headers]

    and whats the theory of tetris game (is that a whole >>> Matrix or strings or ???)

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    You're not going to be able to do it without "bonus headers" because there's no standard way to draw arbitrarily to the screen. You have to pick a library to help you out. Do you want to do it in the console or in a GUI? What OS are you using? What compiler are you using?
    If you understand what you're doing, you're not learning anything.

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    First learn use standard output (console), and input (keyboard).
    Then use bi-dimensional arrays. This could be your board var:
    Code:
    char board[40][10]={
        {' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
        {' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
        {' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
        {' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
        {' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
        {' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
        {' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
        {' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
        {' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
        {' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
        {' ',' ',' ',' ',' ','o','o','o',' ',' '},
        {' ','o','o','o',' ',' ',' ','o','o','o'},
        {'o','o','o','o','o','o','o','o',' ','o'}
    /***************************/
    };
    Then put all those in a while cicle

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how could i write this program: cat < apa | wc | wc > bepa
    By strugglingman in forum C Programming
    Replies: 2
    Last Post: 04-26-2006, 04:40 PM
  2. Replies: 5
    Last Post: 03-18-2006, 11:25 AM
  3. program to make a floppy write protected
    By shrijeetp in forum C Programming
    Replies: 1
    Last Post: 10-03-2005, 06:00 AM
  4. Reroute where programs write to
    By willc0de4food in forum C Programming
    Replies: 7
    Last Post: 09-21-2005, 04:48 PM
  5. Function to write string 3 times
    By Giggs in forum C++ Programming
    Replies: 15
    Last Post: 12-24-2002, 04:00 PM